package com.fafu.common.web.bean;

import java.time.LocalDateTime;

public class ResultUtil {
    public static Result success() {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("成功");
        return result;
    }

    public static Result success(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("成功");
        result.setData(data);
        return result;
    }

    public static Result error() {
        Result result = new Result();
        result.setCode(500);
        result.setMsg("失败");
        return result;
    }

    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }


    public static void main(String[] args) {
        //Result error = ResultUtil.error().addData("a", "aaaa", "b", LocalDateTime.now(), "c", true);
        //System.out.println(error);

        //ResultBean res = ResultBeanUtil.success(DataUtil.build(UserVO.class));
        //System.out.println(res);
    }
}
